package com.zenaprod.twodcore.ui.menu;

import com.zenaprod.twodcore.ui.GameView;

import java.awt.*;

public class MenuView {
    protected GameView parentGameView;
    protected int x, y;
    protected int width, height;
    protected int globalWidth, globalHeight;
    protected Color backgroundColor;
    protected String name;

    protected MenuCloseBar closeBar;

    public MenuView(GameView parentGameView, String name, int x, int y, int width, int height) {
        this.parentGameView = parentGameView;
        this.name = name;
        this.closeBar = new MenuCloseBar(this, x, y, width);
        this.x = x;
        this.y = y + closeBar.getHeight();

        this.width = width;
        this.height = height;
        this.globalWidth = width;
        this.globalHeight = height + closeBar.getHeight();
        this.backgroundColor = new Color(0, 0, 0);
    }


    public void draw(Graphics2D g2D) {
        closeBar.draw(g2D);
        g2D.setColor(backgroundColor);
        g2D.drawRect(x, y, width, height);
    }


    public void setCloseBarBackgroundColor(Color backgroundColor) {
        closeBar.setBackgroundColor(backgroundColor);
    }

    public void setCloseBarHeight(int height) {
        closeBar.setHeight(height);
    }


    public boolean equals(MenuView menuView) {
        return menuView.getName().equals(name);
    }


    public String getName() {
        return name;
    }


}
